package cn.brondfish.icedfish.database.system.dao;

import androidx.room.Dao;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;

import java.util.List;

import cn.brondfish.icedfish.database.system.entity.SysUserRole;

@Dao
public interface SysUserRoleDao {
    @Insert(onConflict = OnConflictStrategy.IGNORE)
    public void insert(List<SysUserRole> roles);

    @Query("DELETE FROM sys_user_role")
    public void delete();

    @Query("SELECT rolekey FROM sys_user_role WHERE device = :device")
    public List<String> getRoles(String device);

    @Query("SELECT count(rolekey) FROM sys_user_role WHERE device = :device and rolekey = :rolekey")
    public boolean haveRolekey(String device,String rolekey);

}
